<%--
  Created by IntelliJ IDEA.
  User: 18785
  Date: 2024/12/16
  Time: 下午6:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>车票管理</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        header {
            background-color: #007bff;
            color: white;
            text-align: center;
            padding: 1rem;
        }
        main {
            flex-grow: 1;
            padding: 2rem;
        }
        a.add-ticket {
            display: block;
            text-align: center;
            margin-bottom: 1rem;
            color: #007bff;
            text-decoration: none;
            font-size: 1rem;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 2rem;
            background-color: white;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        th, td {
            padding: 0.5rem;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        th {
            background-color: #007bff;
            color: white;
        }
        tr:hover {
            background-color: #f5f5f5;
        }
        td a {
            color: #007bff;
            text-decoration: none;
            margin-right: 0.5rem;
        }
        td a:hover {
            text-decoration: underline;
        }
        footer {
            text-align: center;
            padding: 1rem;
            background-color: #007bff;
            color: white;
            margin-top: auto;
        }
    </style>
</head>
<body>
<header>
    <h1>车票管理</h1>
</header>
<main>
    <a href="add-ticket" class="add-ticket">添加新车次</a>
    <table>
        <thead>
        <tr>
            <th>ID</th>
            <th>行程</th>
            <th>车票类型</th>
            <th>始发地</th>
            <th>终到达</th>
            <th>出发日期</th>
            <th>发车时间</th>
            <th>到达时间</th>
            <th>车票价格</th>
            <th>是否携带婴儿</th>
            <th>是否携带儿童</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${tickets}" var="ticket">
            <tr>
                <td>${ticket.id}</td>
                <td>${ticket.type}</td>
                <td>${ticket.ticketType}</td>
                <td>${ticket.departureCity}</td>
                <td>${ticket.arrivalCity}</td>
                <td>${ticket.departureDate}</td>
                <td>${ticket.startTime}</td>
                <td>${ticket.endTime}</td>
                <td>${ticket.price}</td>
                <td>${ticket.hasInfantOption ? '是' : '否'}</td>
                <td>${ticket.hasChildOption ? '是' : '否'}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/edit-ticket?id=${ticket.id}">编辑</a>
                    <a href="${pageContext.request.contextPath}/delete-ticket?id=${ticket.id}" onclick="return confirm('是否删除此行程?')">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</main>
<footer>
    <p>&copy; 2024 车票管理后台</p>
</footer>
</body>
</html>
